package com.example.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.common.R;
import com.example.dto.SetmealDto;
import com.example.entity.Dish;
import com.example.entity.Setmeal;
import com.example.service.SetmealDishService;
import com.example.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 套餐 前端控制器
 * </p>
 *
 * @author lw
 * @since 2023-01-31
 */
@RestController
@RequestMapping("/setmeal")
public class SetmealController {
    @Autowired
    private SetmealService setmealService;


    @GetMapping("/page")
    public R<Page> getPage(int page, int pageSize, String name){

        return setmealService.getPage(page,pageSize,name);
    }
    @PostMapping
    public R<String> sava(@RequestBody SetmealDto setmealDto){
        return setmealService.saveAndDish(setmealDto);
    }
    @DeleteMapping
    public R<String> deleteCategory(@RequestParam List<Long> ids){
        return setmealService.delete(ids);
    }
    @GetMapping("/list")
    public R<List<Setmeal>> findOne(Setmeal setmeal){

        return setmealService.findOne(setmeal);
    }
}

